<?php

namespace IDock\Insurance\DBIC\Request;

use IDock\Insurance\DBIC\Response\UnderwritingResponse;
use IDock\Visitor\Premium\PremiumInquiryVisitor;

class UnderwritingRequest extends AllDBICRequest
{
    protected $route = 'dbic/qos/proposal/quoteToProposal';

    protected $response = UnderwritingResponse::class;

    protected $urlTip = '提交核保';

    /*** @var  PremiumInquiryVisitor $visitor */
    protected $visitor;

    public function generate(): array
    {
        $inquiryNo = $this->visitor->getUnderwritingVisitor()->inquiryNo;
        $ciInquiryNo = $this->visitor->getUnderwritingVisitor()->ciInquiryNo;
        $biInquiryNo = $this->visitor->getUnderwritingVisitor()->biInquiryNo;

        if ($ciInquiryNo and strstr($inquiryNo, $ciInquiryNo)) {
            $inquiryNo = '';
        }

        if ($biInquiryNo and strstr($inquiryNo, $biInquiryNo)) {
            $inquiryNo = '';
        }

        return [
            'quoteOrderNo' => $inquiryNo
        ];
    }
}
